#

| Chapter 20 Program Debugging |

## 20.2 The Dbx Debugger

Dbx can be used to debug programs written in C, C++, FORTRAN, and Pascal. Dbx commands can be stored in a start-up .dbxinit file that resides in the current directory or in the user's home directory. These commands are executed just before reading the symbol table. The command-line syntax for dbx is as follows:

> dbx [`options`] [`objfile` [`corefile`]]

### 20.2.1 Options

-c `cmd`

  Run dbx `cmd` after initialization.

-C

  Collect profile data for debugged program.

-e

  Echo input commands on standard output.

-i

  Act as if standard input is a terminal.

-I `dir`

  Add `dir` to the directory search path. The dbx command use resets the search path.

-kbd

  Debug a program that puts the keyboard in up-down translation mode.

-P `file_des`

  Pipe output to the debugger command via file descriptor `file_des`. debugger passes this option automatically.

-q

  Suppress messages during loading (useful during auto-traceback).

-r

  Execute `objfile` right away, then wait for user response from the keyboard.

-s `file`

  Read initialization commands from start-up `file`.

-sr `tmp`

  Like -s, but then delete start-up file (`tmp`).

- `pid`

  Debug a currently running program whose process ID is `pid` (used mainly for auto-traceback).

### 20.2.2 Alphabetical Summary of Commands

Within dbx, the most useful commands are run, where, print, and stop. Use help to summarize the available commands. In the listing below, the term `func` is used to represent either a procedure or a function.

- alias
- assign
- call
- catch
- cd
- clear
- cont
- CTRL-C
- dbxenv
- debug
- delete
- detach
- display
- down
- dump
- edit
- file
- func
- help
- history
- ignore
- kill
- language
- list
- make
- modules
- next
- nexti
- print
- pwd
- quit
- replay
- rerun
- restore
- return
- run
- save
- set
- setenv
- sh
- source
- status
- step
- step
- stepi
- stop
- stopi
- trace
- tracei
- unalias
- undisplay
- unset
- up
- use
- whatis
- when
- where
- whereis
- which
- `search`
- `addr1`/
- `address`

20.1 The Sdb Debugger |  | 21. ASCII Character Set